home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / gcc270_src.lha / gcc-2.7.0-amiga / config / m88k / sysv3.h < prev    next >
C/C++ Source or Header  |  1995-06-15  |  5KB  |  140 lines

  1. /* Definitions of target machine for GNU compiler.
  2.    Motorola m88100 running the AT&T/Unisoft/Motorola V.3 reference port.
  3.    Copyright (C) 1990, 1991 Free Software Foundation, Inc.
  4.    Contributed by Ray Essick (ressick@mot.com)
  5.    Enhanced by Tom Wood (Tom_Wood@NeXT.com)
  6.  
  7. This file is part of GNU CC.
  8.  
  9. GNU CC is free software; you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation; either version 2, or (at your option)
  12. any later version.
  13.  
  14. GNU CC is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with GNU CC; see the file COPYING.  If not, write to
  21. the Free Software Foundation, 59 Temple Place - Suite 330,
  22. Boston, MA 02111-1307, USA.  */
  23.  
  24. #include "m88k/m88k.h"
  25.  
  26. /* Default switches */
  27. #undef    TARGET_DEFAULT
  28. #define TARGET_DEFAULT    (MASK_CHECK_ZERO_DIV    | \
  29.              MASK_OCS_DEBUG_INFO    | \
  30.              MASK_OCS_FRAME_POSITION)
  31.  
  32. /* Macros to be automatically defined.  */
  33. #undef    CPP_PREDEFINES
  34. #define CPP_PREDEFINES "-Dm88000 -Dm88k -Dunix -DsysV88 -D__CLASSIFY_TYPE__=2 -Asystem(unix) -Asystem(svr3) -Acpu(m88k) -Amachine(m88k)"
  35.  
  36. /* Override svr3.h to link with ?crt0.o instead of ?crt1.o and ?crtn.o.
  37.    From arul@sdsu.edu.  */
  38. #undef    STARTFILE_SPEC
  39. #define STARTFILE_SPEC \
  40.    "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} crtbegin.o%s"
  41.  
  42. /* Profiled libraries live in a different directory but keep the same
  43.    names other than that.  arul@sdsu.edu says -lg is always needed.  */
  44. #undef    LIB_SPEC
  45. #define LIB_SPEC "%{p:-L/lib/libp}%{pg:%{!p:-L/lib/libp}} -lg -lc crtend.o%s"
  46.  
  47. /* Hot version of the profiler that uses r10 to pass the address of
  48.    the counter.  the _gcc_mcount routine knows not to screw with
  49.    the parameter registers.
  50.  
  51.    DG/UX does this; i wrote a gnu-c/88k specific version and put it
  52.    in libgcc2.c -- RBE; this macro knows about the leading underscore
  53.    convention.  */
  54. #undef    FUNCTION_PROFILER
  55. #define FUNCTION_PROFILER(FILE, LABELNO) \
  56.   output_function_profiler (FILE, LABELNO, "_gcc_mcount", 0)
  57.  
  58. /* Various other changes that we want to have in place without
  59.    too many changes to the m88k.h file.  */
  60. #undef    USE_LIBG
  61. #define    USE_LIBG
  62.  
  63. /* Define a few machine-specific details of the implementation of
  64.    constructors.  */
  65.  
  66. /* Although the .init section is used, it is not automatically invoked.  */
  67. #define INVOKE__main
  68.  
  69. /* State that atexit exists so __do_global_ctors will register
  70.    __do_global_dtors.  */
  71. #define HAVE_ATEXIT
  72.  
  73. #define CTOR_LIST_BEGIN                \
  74.   asm (INIT_SECTION_ASM_OP);        \
  75.   asm ("\tsubu\t r31,r31,16");    /* (STACK_BOUNDARY / BITS_PER_UNIT) == 16 */ \
  76.   asm ("\tst\t r0,r31,32");    /* REG_PARM_STACK_SPACE (0) == 32 */
  77. #define CTOR_LIST_END
  78.  
  79. /* ASM_OUTPUT_CONSTRUCTOR outputs code into the .init section to push the
  80.    address of the constructor.  This becomes the body of __do_global_ctors
  81.    in crtstuff.c.  r13 is a temporary register.  */
  82. #undef    ASM_OUTPUT_CONSTRUCTOR
  83. #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)                \
  84.   do {                                    \
  85.     init_section ();                            \
  86.     fprintf (FILE, "\tor.u\t r13,r0,hi16(");                \
  87.     assemble_name (FILE, NAME);                        \
  88.     fprintf (FILE, ")\n\tor\t r13,r13,lo16(");                \
  89.     assemble_name (FILE, NAME);                        \
  90.     fprintf (FILE, ")\n\tsubu\t r31,r31,%d\n\tst\t r13,r31,%d\n",    \
  91.          STACK_BOUNDARY / BITS_PER_UNIT, REG_PARM_STACK_SPACE (0));    \
  92.   } while (0)
  93.  
  94. #undef    DO_GLOBAL_CTORS_BODY
  95. #define DO_GLOBAL_CTORS_BODY                        \
  96. do {                                    \
  97.   func_ptr *__CTOR_LIST__ = __builtin_alloca (1), *p;            \
  98.   for (p = __CTOR_LIST__ + 4; *p; p += 4)                \
  99.     (*p) ();                                \
  100. } while (0)
  101.  
  102. #define DTOR_LIST_BEGIN                            \
  103.   asm (FINI_SECTION_ASM_OP);                        \
  104.   func_ptr __DTOR_LIST__[4] = { (func_ptr) (-1), (func_ptr) (-1),    \
  105.                 (func_ptr) (-1), (func_ptr) (-1) }
  106. #define DTOR_LIST_END                              \
  107.   asm (FINI_SECTION_ASM_OP);                        \
  108.   func_ptr __DTOR_END__[4] = { (func_ptr) 0, (func_ptr) 0,        \
  109.                    (func_ptr) 0, (func_ptr) 0 }  
  110.  
  111. /* A C statement (sans semicolon) to output an element in the table of
  112.    global destructors.  The table is constructed in the .fini section
  113.    so that an explicit linker script is not required.  The complication
  114.    is that this section is padded with NOP instructions and to either
  115.    8 or 16 byte alignment depending on the specific system.  A clever
  116.    way to avoid trouble is to output a block of 16 bytes where the
  117.    extra words are known values (-1).  */
  118. #undef    ASM_OUTPUT_DESTRUCTOR
  119. #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)    \
  120.   do {                        \
  121.     register int i;                \
  122.     fini_section ();                \
  123.     fprintf (FILE, "\t%s\t ", ASM_LONG);    \
  124.     assemble_name (FILE,NAME);            \
  125.     fprintf (FILE, "\n");            \
  126.     for (i = 1; i < 4; i++)            \
  127.       fprintf (FILE, "\t%s\t -1\n", ASM_LONG);    \
  128.     } while (0)
  129.  
  130. /* Walk the list looking for the terminating zero and ignoring all values of
  131.    -1.  */
  132. #undef    DO_GLOBAL_DTORS_BODY
  133. #define DO_GLOBAL_DTORS_BODY            \
  134.   do {                        \
  135.     int i;                    \
  136.     for (i = 0; __DTOR_LIST__[i] != 0; i++)    \
  137.       if (((int *)__DTOR_LIST__)[i] != -1)    \
  138.     __DTOR_LIST__[i] ();            \
  139.   } while (0)                    
  140.